package io.renren.modules.log.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.page.PageData;
import io.renren.common.page.PageUtils;
import io.renren.modules.log.dao.SysLogOperationDao;
import io.renren.modules.log.dto.SysLogOperationDTO;
import io.renren.modules.log.dto.SysLogOperationQueryDto;
import io.renren.modules.log.entity.SysLogOperationEntity;
import io.renren.modules.log.service.SysLogOperationService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 操作日志
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0
 */
@Service
public class SysLogOperationServiceImpl extends ServiceImpl<SysLogOperationDao, SysLogOperationEntity> implements SysLogOperationService {

    @Override
    public PageData<SysLogOperationDTO> page(SysLogOperationQueryDto queryDto) {
        Page<SysLogOperationDTO> page = new Page<>(queryDto.getPage(), queryDto.getLimit());
        PageUtils.setOrder(page, queryDto.getOrderField(), queryDto.getOrder());
        Page<SysLogOperationDTO> pageVo = baseMapper.page(page, queryDto);
        return PageUtils.getPageData(pageVo.getRecords(), pageVo.getTotal(), SysLogOperationDTO.class);
    }

    @Override
    public List<SysLogOperationDTO> list(SysLogOperationQueryDto queryDto) {
        return baseMapper.page(queryDto);
    }

}